package utils

import (
	"os"
	"path"
	"path/filepath"
)

// 获取当前执行程序的绝对路径
func GBPathAbsExecutable() string {
	pathSelf, _ := filepath.Abs(os.Args[0])
	return pathSelf
}

// 获取基于当前执行程序所在目录的文件绝对路径
func GBPathAbsRelativeExecutable(filepath string) string {
	if path.IsAbs(filepath) {
		return filepath
	}
	return path.Join(GBPathAbsFolderOfExecutable(), filepath)
}

// 获取当前执行程序的所在目录，绝对路径
func GBPathAbsFolderOfExecutable() string {
	return filepath.Dir(GBPathAbsExecutable())
}
